package com.prj.ufdm.web.enums;

/**
 * WEB服务模块返回码（编码规则：08 + 2位功能编号  + 3位错误编号）
 * @author 胡义振
 * @date 2019-08-21
 */
public enum WebRetCodeEnum {
	
	RET_CODE_0801001("0801001","未登录"),
	RET_CODE_0801002("0801002","登录失败"),
	RET_CODE_0801003("0801003","注销成功"),
	RET_CODE_0801004("0801004","登录异常"),
	RET_CODE_0801005("0801005","Token不存在"),
	RET_CODE_0801006("0801006","Token验证异常"),
	RET_CODE_0801007("0801007","未授权"),
	RET_CODE_0801008("0801008","Token为空"),
	RET_CODE_0801009("0801009","Token超时"),
	RET_CODE_0801010("0801010","获取用户权限异常"),
	
	RET_CODE_0802001("0802001","用户名不能为空"),
	RET_CODE_0802002("0802002","用户密码不能为空"),
	RET_CODE_0802003("0802003","用户名已存在"),
	RET_CODE_0802004("0802004","用户ID不能为空"),
	RET_CODE_0802005("0802005","用户ID不存在"),
	RET_CODE_0802006("0802006","老密码不能为空"),
	RET_CODE_0802007("0802007","原密码不正确"),
	
	RET_CODE_0803001("0803001","角色ID不能为空"),
	RET_CODE_0803002("0803002","功能ID不能为空"),

	RET_CODE_0899999("RET_CODE_0199999","其他错误");
	
	private String code;
	private String message;
	
	
	WebRetCodeEnum(String code,String message){
		this.code = code;
		this.message = message;
	}
	
	public static String getRetCodeName(String retErrCode){
		String rtnRetErrCode = "";
		for (WebRetCodeEnum authRetCodeEnum : WebRetCodeEnum.values()) {
			if(authRetCodeEnum.code.equals(retErrCode)){
				rtnRetErrCode = authRetCodeEnum.message;
			}
	    }
		return rtnRetErrCode;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}


}
